package com.example.demo.day.easyExcel.primary.day1.pro.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.example.demo.day.easyExcel.primary.day1.pro.entity.EduSubject;
import com.example.demo.day.easyExcel.primary.day1.pro.entity.SubjectData;
import com.example.demo.day.easyExcel.primary.day1.pro.other.GuliException;
import com.example.demo.day.easyExcel.primary.day1.pro.service.EduSubjectService;
import lombok.SneakyThrows;

public class SubjectExcelListener extends AnalysisEventListener<SubjectData> {

    public EduSubjectService subjectService;

    public SubjectExcelListener() {}

    public SubjectExcelListener(EduSubjectService subjectService) {
        this.subjectService = subjectService;
    }

    @SneakyThrows
    @Override
    public void invoke(SubjectData subjectData, AnalysisContext analysisContext) {
        if (subjectData == null) {
            throw new GuliException();
        }
    }

    //判断一级分类不能重复添加
    private EduSubject existOneSubject(EduSubjectService subjectService, String name) {

        return null;
    }

    //判断二级分类不能重复添加
    private EduSubject existTwoSubject(EduSubjectService subjectService, String name, String pid) {

        return null;
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
